﻿using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.NetduinoPlus;
using Bt.SecuritySystem;
using Bt.Core;

namespace Bt.DoorWebServer
{
    public class Program
    {
        
        public static void Main()
        {
           Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0].EnableDhcp();

           Utility.SetLocalTime(Ntp.GetNetworkTime().AddHours(2));
           Debug.Print("DateTime " + DateTime.UtcNow);
           Log.Write("DateTime "+ DateTime.UtcNow);

           Log.OnSdCard_Change += OnSdCard_Change;

           Log.Write("Web Server start");

           WebServer webServer = new WebServer(new DoorController(new Alerter()));

           // webServer.ListenForRequest();
        }

        

        public static void OnSdCard_Change(Log.SdCardState state)
        {
            Debug.Print("Někdo hrabe na SDčko :)" + state);
        }
    }
}